package com.phyane.home.service;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.phyane.common.baseopp.DataBaseOpp;
import com.phyane.home.data.HomePartData;

public class HomeService {

	public List<HomePartData> getHomePart(){
		List<HomePartData> list = new ArrayList<HomePartData>();
		String sql = "select * from home_part_info";
		ResultSet rst = null;
		try {
			Connection conn = DataBaseOpp.getConnection();
			Statement st = conn.createStatement();
			rst = st.executeQuery(sql);
			if(rst != null){
				while(rst.next()){
					HomePartData data = new HomePartData();
					data.setId(rst.getInt("id"));
					data.setInfo(rst.getString("name"));
					list.add(data);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
}
